{% extends 'layouts/base.html' %}
{% block content %}
<script type="text/javascript">
    //调用微信JS api 支付
    function jsApiCall()
    {
    WeixinJSBridge.invoke(
            'getBrandWCPayRequest',
    {{jsApiParameters | raw}},
            function(res){
                //WeixinJSBridge.log(res.err_msg); 				
               // alert(res.err_code+res.err_desc+res.err_msg);
                if (res.err_msg == "get_brand_wcpay_request:ok"){
                    window.location.href = "{{url('Mobileregister/userinfo')}}";
                }
            }
    );
    }

    function callpay()
    {
        if (typeof WeixinJSBridge == "undefined"){
            if (document.addEventListener){
                document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
            } else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
            }
        } else{
            jsApiCall();
        }
    }
</script>
<script type="text/javascript">
    //获取共享地址
    function editAddress()
    {
    WeixinJSBridge.invoke(
            'editAddress',
    {{editAddress | raw}},
            function(res){
            var value1 = res.proviceFirstStageName;
            var value2 = res.addressCitySecondStageName;
            var value3 = res.addressCountiesThirdStageName;
            var value4 = res.addressDetailInfo;
            var tel = res.telNumber;
            }
    );
    }

    window.onload = function(){
        if (typeof WeixinJSBridge == "undefined"){
            if (document.addEventListener){
                document.addEventListener('WeixinJSBridgeReady', editAddress, false);
            } else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', editAddress);
                document.attachEvent('onWeixinJSBridgeReady', editAddress);
            } 
        } else{
             editAddress();
        }
    };

</script>
<div id="container" class="bj_color info_content_wrap info_content_wrap_two">
    <div class="weui_cells weui_cells_margin">
        <div class="weui_cell row_cell_two">
            <div class="weui_cell_hd big_left_txt">
                总价格
            </div>
            <div class="weui_cell_bd weui_cell_primary big_right_txt">
                <p>{{fee.total_price}}</p>
            </div>  
        </div>  
    </div>  
    
    {%if fee.meal_type == 1%}
      <div class="weui_cells weui_cells_margin">
            <div class="weui_cell row_cell_two">
               <div class="weui_cell_hd left_txt">
                    <label class="weui_label">套餐类型</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary right_txt">
                    <p>{{fee.option_list[0]}}</p>
                </div>  
            </div> 
            <div class="weui_cell row_cell_two">
               <div class="weui_cell_hd left_txt">
                    <label class="weui_label">服务内容</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary right_txt">
                    {{fee.content_list[0]|raw}}
                </div>  
            </div>  
            <div class="weui_cell row_cell_two">
                <div class="weui_cell_hd left_txt">
                    <label class="weui_label">价格</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary right_txt">
                    <p>{{fee.price_list[0]}}元</p>
                </div> 
            </div>   
      </div> 
    {%else%}
        {% for k,v in fee.option_list %}
       <div class="weui_cells weui_cells_margin">
           <div class="weui_cell row_cell_two">
               <div class="weui_cell_hd left_txt">
                   <label class="weui_label">序号</label>
               </div>
               <div class="weui_cell_bd weui_cell_primary right_txt">
                   <p>{{k+1}}</p>
               </div>  
           </div> 
           <div class="weui_cell row_cell_two">
               <div class="weui_cell_hd left_txt">
                   <label class="weui_label">项目内容</label>
               </div>
               <div class="weui_cell_bd weui_cell_primary right_txt">
                   <p>{{fee.option_list[k]}}</p>
               </div>  
           </div>  
           <div class="weui_cell row_cell_two">
               <div class="weui_cell_hd left_txt">
                   <label class="weui_label">业务内容</label>
               </div>
               <div class="weui_cell_bd weui_cell_primary right_txt">
                   <p>{{fee.content_list[k]}}</p>
               </div> 
               <div class="weui_cell_ft most_right_txt">
                   <p>{{fee.price_list[k]}}</p>
               </div> 
           </div>   
       </div> 
       {%endfor%}
    
    {%endif%}
   
    
    <div class="pay_info_red">
        <div class="sum_money">按{{fee.deposit_rate}}%的预约金额：<span class="red_font pay_font">{{deposit}}</span>元   预约金额最低为{{mini_depoist}}元  {% if coupon_fee is not empty %}* 已优惠<span class="red_font ">{{coupon_fee}}</span>元{%endif%}</div>
        <div class="btn_box">
            <a class="weui_btn submit_btn"   onclick="callpay()">确认支付</a>
        </div>
    </div>                     
</div>          
{% endblock %}